<script>

$(document).ready(function () { 

   var zhanshiboxsetInterval;

   $(function(){	

      /*   

	   if( String(location).indexOf("Wap&c=Index&a=index") == -1 && String(location).indexOf("Wap&c=Index&a=hb") == -1 ){

		    $.post("{:U('Ajax/checkzhanghu')}",{},function(res){

				if(res.code==1){

					 alert('请先拆红包');

					 $.post("{:U('Ajax/gethbid')}",{hbid:{$hb[id]|intval}},function(res){

					     location.href='{:U("hb?hbid=")}'+res.hbid;

					 },'json');

				}

			},'json');

	   }

	   */

	   $.post("{:U('Ajax/getfaqiancishu')}",{},function(res){});

	   $.post('{:U("Ajax/fayongjin")}',{},function(){	});

	   $.post('{:U("Ajax/checkuserhb")}',{},function(){	});

	   zhanshiboxsetInterval = setInterval(zhanshibox, 10000);

	   zhanshibox();

   });

   $('#qianghongbao').click(function(){

	   $.post("{:U('Ajax/gethbid')}",{hbid:{$hbid|intval}},function(res){

			location.href='{:U("Index/hb?hbid=")}'+res.hbid;

	   },'json');

   });

   $('#checkdaili').click(function(){

	   $.post("{:U('Ajax/checkdaili')}",{},function(res){

		   if(res.code == 0){

			   location.href='{:U("Index/kefu")}';

		   } else {

			   location.href='{:U("Index/daili")}';

		   }

	   },'json');

   });

   $('.msgbox .but').click(function(){

	    var msgbox = $("input[name='msgbox']").val();

		if(msgbox == 1){

            $.post("{:U('Ajax/checkzhanghu')}",{hbid:{$hbid|intval}},function(res){

				if(res.code==1){

					location.href = "{:U('Index/hb?hbid='.$hbid)}";

				} else {

				    location.href = "{:U('Index/hb?hbid='.$hbid)}";

				}

			},'json');

			return false;

		}

		if(msgbox == 2){

            $.post("{:U('Ajax/checkzhanghu')}",{hbid:{$hbid|intval}},function(res){

				if(res.code==1){

					location.href = "{:U('Zhuanpan/index')}";

				} else {

				    location.href = "{:U('Chongzhi/chong?ctype=2&hbid='.$hbid)}";

				}

			},'json');

			return false;

		}

		if(msgbox == 3){

            $.post("{:U('Ajax/checkzhanghu')}",{hbid:{$hbid|intval}},function(res){

				if(res.code==1){

					location.href = "{:U('Guaguale/index')}";

				} else {

				    location.href = "{:U('Chongzhi/chong?ctype=4&hbid='.$hbid)}";

				}

			},'json');

			return false;

		}

		if(msgbox == 4){

			location.href = "{:U('Ucenter/index')}";	

			return false;

		}

		$('.msgbox').hide();

   });   

});

function zhanshibox(){

	$.post("{:U('Ajax/zhanshibox')}",{},function(res){	 

	    $('.zhanshibox').show(500);

	    if(res.code == 1){

		    $('.zhanshibox').hide();

			clearInterval(zhanshiboxsetInterval);

		}   

		$('.zhanshibox p').html(res.html);

		$('.zhanshibox p').fadeIn(500);

	},'json');

	setTimeout(function(){$('.zhanshibox p').fadeOut(500);}, 8000);

}

</script>

<style>

.zhanshibox { position: fixed; top: 0; left: 0; right: 0; height: 24px; background-color: rgba(0,0,0,0.3); text-align: center; font-size: 12px; line-height: 24px; color: #FFF; display: none; z-index: 9; }

.zhanshibox p { display: none; }

.zhanshibox span { color: #3F0; border: #3F0 1px solid; padding-left: 2px; padding-right: 2px; border-radius: 2px; }

</style>

<div class="msgbox">

  <input type="hidden" value="0" name="msgbox">

  <!--

      0无跳转 

      1拆红包 

      2转盘 

      3刮刮卡

      4个人中心

  -->

  <div class="box">

    <p class="title">提示</p>

    <p class="txt">恭喜您获得0元红包</p>

    <p class="but">确定</p>

  </div>

</div>

<div class="zhanshibox">

  <p></p>

</div>

<div id="dengdai">

    <div class="loading">

           <span></span>

           <span></span>

           <span></span>

           <span></span>

           <span></span>

    </div>

</div>

<div style="height:60px;"></div>

<script>

$(document).ready(function(){

    $('.toggle-sub-menu').click(function(){

        //alert(JSON.stringify(this.dataset));

        var selector = '#' + this.dataset.subMenuId;

        

        $('.sub-menu').hide();

        $(selector).fadeIn();

    })

});

</script>

<style>

.sub-menu {

	background: #333333;

    /* height: 50px; */

	position: fixed;

    /* left: 0; *//* bottom: 0; *//* right: 0; */

	padding: 9px 3px;

	width: 20%;

	/*font-size: 0.8em;*/

	

	display: none;

}



.sub-menu li:first-child {

	padding: 1px 0 6px 0;

}

.sub-menu li {

	/*width: 25%;*/

	text-align: center;

	/* float: left; */

	color: #FFF;

	/*border-right: #FFF 1px solid;*/

	border-bottom: darkgrey 1px solid;

	line-height: 14px;

	padding: 6px 0;

}



.sub-menu li:last-child {

	border: none;

	padding: 6px 0 0 0;

}



.sub-menu li a {

	color: #FFF;

}



</style>

<div id="sub-menu-more-game" class="sub-menu" style="bottom: 50px; left: 26%;">

 <!-- <ul>

    <li><a href="{:U('Zhuanpan/index?randres='.rand(100,999))}">转盘</a></li>

    <li><a href="{:U('Guaguale/index?randres='.rand(100,999))}">刮刮乐</a></li>

    <li><a href="{:U('Saolei/index?randres='.rand(100,999))}">扫雷</a></li> 

  </ul>  -->

</div>

<div id="sub-menu-free-game" class="sub-menu" style="bottom: 50px; left: 20%">

  <ul>

    <li><a href="{:U('Checkin/index?randres='.rand(100,999))}">签到</a></li>

    <li><a href="{:U('Appraise/scoreboard?randres='.rand(100,999))}">分享有奖</a></li>

  </ul>

</div>

<div class="footer">

  <ul>

      <!-- 拆福包 免费玩  更多游戏  代理   我 -->

    <li style="width: 25%"><a href="{:U('Index/index?randres='.rand(100,999))}">拆福包</a></li>

    <!--<li style="width: 20%" class="toggle-sub-menu" data-sub-menu-id="sub-menu-free-game">免费玩</li>-->

    <li style="width: 25%"><a href="{:U('Saolei/index?randres='.rand(100,999))}">扫雷</a></li>

    <li style="width: 25%" id="checkdaili">代理</li>
	<!--<li style="width: 20%" id="checkdaili"><a href="http://yyhb.cfgxq.cn/index.php?m=Wap&c=Index&a=kefu">客服</a></li>-->


    <li style="width: 25%"><a href="{:U('Ucenter/index?randres='.rand(100,999))}">我</a></li>

      <!--

    <li><a href="{:U('Index/index?randres='.rand(100,999))}">拆福包</a></li>

    <li><a href="{:U('Zhuanpan/index?randres='.rand(100,999))}">转盘</a></li>

    <li><a href="{:U('Guaguale/index?randres='.rand(100,999))}">刮卡</a></li>

    -->

    <!--<li><a href="{:U('Index/yongjin')}">佣金</a></li>-->

      <!--

    <li><a href="{:U('Saolei/index?randres='.rand(100,999))}">扫雷</a></li>

    <li id="checkdaili">代理</li>

    <li><a href="{:U('Ucenter/index?randres='.rand(100,999))}">我</a></li>

      <!--

  </ul>

</div>

